#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/mman.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <linux/fb.h>
#include <linux/kd.h>
#include "./jpeg/jpeglib.h"
#include "org_screenshot_ScreenShot.h"
#include <android/log.h>
struct _FBInfo;
typedef struct _FBInfo FBInfo;
typedef int (*UnpackPixel)(FBInfo* fb, unsigned char* pixel,
	unsigned char* r, unsigned char* g, unsigned char* b);

struct _FBInfo
{
	int fd;
	unsigned char *bits;
	struct fb_fix_screeninfo fi;
	struct fb_var_screeninfo vi;
	UnpackPixel unpack;
};

#define fb_width(fb)  ((fb)->vi.xres)
#define fb_height(fb) ((fb)->vi.yres)
#define fb_bpp(fb)    ((fb)->vi.bits_per_pixel>>3)
#define fb_size(fb)   ((fb)->vi.xres_virtual * (fb)->vi.yres_virtual * fb_bpp(fb))
#define fb_line_length(fb) ((fb)->fi.line_length)
int snap2jpg(const char * filename, int quality, FBInfo* fb);
int fb_open(FBInfo*, const char*);
void fb_close(FBInfo*);
